.class public Lcom/instagram/creation/video/mediarecorder/a;
.super Ljava/lang/Object;
.source "DataPacket.java"


# instance fields
.field private a:I

.field private b:Ljava/nio/ByteBuffer;

.field private c:Lcom/instagram/creation/video/mediarecorder/c;


# direct methods
.method public constructor <init>([BI)V
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 28
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 29
    add-int/lit8 v0, p2, 0x8

    iput v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->a:I

    .line 30
    iget v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->a:I

    invoke-static {v0}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    .line 32
    new-instance v0, Lcom/instagram/creation/video/mediarecorder/c;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/instagram/creation/video/mediarecorder/c;-><init>(Lcom/instagram/creation/video/mediarecorder/a;Lcom/instagram/creation/video/mediarecorder/b;)V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    .line 33
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iput-object p1, v0, Lcom/instagram/creation/video/mediarecorder/c;->a:[B

    .line 34
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    const/16 v1, 0x8

    iput v1, v0, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    .line 35
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v1, v1, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->putInt(I)Ljava/nio/ByteBuffer;

    .line 36
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget-object v1, v1, Lcom/instagram/creation/video/mediarecorder/c;->a:[B

    invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->put([B)Ljava/nio/ByteBuffer;

    .line 37
    return-void
.end method


# virtual methods
.method public a()I
    .locals 1

    .prologue
    .line 44
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v0, v0, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    add-int/lit8 v0, v0, -0x8

    return v0
.end method

.method public a([BI)V
    .locals 3
    .parameter
    .parameter

    .prologue
    .line 52
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v0, v0, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    add-int/2addr v0, p2

    iget v1, p0, Lcom/instagram/creation/video/mediarecorder/a;->a:I

    if-le v0, v1, :cond_0

    .line 53
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Capacity exceeded."

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 55
    :cond_0
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v0, p1}, Ljava/nio/ByteBuffer;->put([B)Ljava/nio/ByteBuffer;

    .line 56
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v1, v0, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    add-int/2addr v1, p2

    iput v1, v0, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    .line 57
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    const/4 v1, 0x0

    iget-object v2, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v2, v2, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    invoke-virtual {v0, v1, v2}, Ljava/nio/ByteBuffer;->putInt(II)Ljava/nio/ByteBuffer;

    .line 58
    return-void
.end method

.method public a(Ljava/io/OutputStream;)Z
    .locals 5
    .parameter

    .prologue
    const/4 v0, 0x0

    .line 70
    :try_start_0
    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v1}, Ljava/nio/ByteBuffer;->array()[B

    move-result-object v1

    const/4 v2, 0x0

    iget-object v3, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v3, v3, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    invoke-virtual {p1, v1, v2, v3}, Ljava/io/OutputStream;->write([BII)V
    :try_end_0
    .catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/IndexOutOfBoundsException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_3

    .line 71
    const/4 v0, 0x1

    .line 84
    :goto_0
    return v0

    .line 72
    :catch_0
    move-exception v1

    .line 73
    const-string v2, "DataPacket"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "ArrayIndexOutOfBoundsException when writing DataPacket; mData.array().length: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v4, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->array()[B

    move-result-object v4

    array-length v4, v4

    invoke-static {v4}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " mAtom.mSize: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v4, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v4, v4, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    invoke-static {v4}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "; "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 76
    :catch_1
    move-exception v1

    .line 77
    const-string v2, "DataPacket"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "IndexOutOfBounds when writing DataPacket; length: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v4, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v4, v4, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    invoke-static {v4}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "; "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 79
    :catch_2
    move-exception v1

    .line 80
    const-string v2, "DataPacket"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "IOException when writing DataPacket; "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_0

    .line 81
    :catch_3
    move-exception v1

    .line 82
    const-string v2, "DataPacket"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "NullPointerException when writing DataPacket; Why is mData.array() null? "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_0
.end method

.method public b()I
    .locals 1

    .prologue
    .line 48
    iget v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->a:I

    add-int/lit8 v0, v0, -0x8

    return v0
.end method

.method public c()V
    .locals 2

    .prologue
    .line 61
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    const/16 v1, 0x8

    iput v1, v0, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    .line 62
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    .line 63
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget v1, v1, Lcom/instagram/creation/video/mediarecorder/c;->b:I

    invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->putInt(I)Ljava/nio/ByteBuffer;

    .line 64
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/a;->b:Ljava/nio/ByteBuffer;

    iget-object v1, p0, Lcom/instagram/creation/video/mediarecorder/a;->c:Lcom/instagram/creation/video/mediarecorder/c;

    iget-object v1, v1, Lcom/instagram/creation/video/mediarecorder/c;->a:[B

    invoke-virtual {v0, v1}, Ljava/nio/ByteBuffer;->put([B)Ljava/nio/ByteBuffer;

    .line 65
    return-void
.end method
